package com.wva.video.elasticsearch.document;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.time.LocalDateTime;

@Data
@Document(indexName = "video")
public class VideoDocument {
    @Id
    @Field(type = FieldType.Long)
    private Long id;

    @Field(type = FieldType.Integer)
    private Integer status;

    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String title;

    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String description;

    @Field(type = FieldType.Long)
    private Long categoryId;

    @Field(type = FieldType.Integer)
    private Integer likeNumber;

    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    private LocalDateTime publishTime;

    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    private LocalDateTime updateTimeUser;

    @Field(type = FieldType.Integer)
    private Integer type;
    /**
     * 时长，单位秒，精确到小数点后两位
     */
    @Field(type = FieldType.Double)
    private Double duration = 0.00;

    @Field(type = FieldType.Long)
    private Long userId;

    //需要自己补充的无法通过拷贝video po
    @Field(type = FieldType.Keyword)
    private String[] tags;

    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String userNickname;
}